<?php
/*
 * Created on Mar 27, 2009
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 class gallery_Form_Gallery extends Zend_Form
 {
     protected $_noDecorator = array(
        'ViewHelper', 
        'Errors'
    );
    /**
     * init() is the initialization routine called when Zend_Form objects are 
     * created. In most cases, it make alot of sense to put definitions in this 
     * method, as you can see below.  This is not required, but suggested.  
     * There might exist other application scenarios where one might want to 
     * configure their form objects in a different way, those are best 
     * described in the manual:
     *
     * @see    http://framework.zend.com/manual/en/zend.form.html
     * @return void
     */ 
	
	public function init()
	{
		 $this->setName('File_Upload')
		 	  ->setAttrib('enctype', 'multipart/form-data')
//		 	  ->setAction('/en/gallery/index/post')
		 	  ->setMethod('post');
		 	  
		$this->setAction($params['action_url']);
		
		 // creating Form_Element_File
		$elementFile = new Zend_Form_Element_File('file_upload');
//		$elementFile->setDestination('/var/www/hvn/public/ustore')
		$elementFile->setLabel('File Upload:')
					->addValidator('Count', false, 1)
					->addValidator('Size', false, 100*1024*1024*100)
//					->addValidator('IsImage', false)//, 'jpg,png,gif,txt,doc')
				  	->setRequired(true);
		$this->addElement($elementFile);

		 // creating submit button
		$submit = new Zend_Form_Element_Submit('upload_button');
        $submit->setAttrib('id', 'upload_button')
        	   ->setLabel('Upload')
        	   ->addDecorators($this->_noDecorator);
        $this->addElement($submit);
	}
 }
?>
